define(['app'], function(app) {
	'use strict';

	// 实例化方法
	var factory = function(Http) {
		
		function get_data_connectagency(result) {
			if(HTTP_ISLOGIC) {
				result = '{"success":true,"msg":"","result":{"act_id":"001","apply_count":1000,"prize_count":1000,"member":[{"member_id":"001","name":"张三","region":"江苏","is_prize":true,"pay_status":"已支付"},{"member_id":"002","name":"张三","region":"江苏","is_prize":true,"pay_status":"已支付"},{"member_id":"1002","name":"张三","region":"江苏","is_prize":true,"pay_status":"已支付"},{"member_id":"2002","name":"张三","region":"江苏","is_prize":true,"pay_status":"已支付"},{"member_id":"3002","name":"张三","region":"江苏","is_prize":true,"pay_status":"已支付"},{"member_id":"4002","name":"张三","region":"江苏","is_prize":true,"pay_status":"已支付"},{"member_id":"5002","name":"张三","region":"江苏","is_prize":true,"pay_status":"已支付"}],"choose_count":100,"pay_count":90},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}


		// 返回信息
		return {
			connectagency: function(act_id, draw_type, callback) {
				Http.post({
						method: 'marketing.goodstest.result',
						act_id: act_id,
						draw_type: draw_type,
						session:''
					},
					function(result) {
						//请求成功
						if(callback)
							callback(get_data_connectagency(result).result);
					},
					function(e) {
						//请求异常
					},
					function() {
						//请求完成，一般不做什么事情
					});
			}
			
		};
	}

	factory.$inject = [ 'Http' ];
	return app.registerService("Luckydraw", factory);
});